<!--
   照片类型配置
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:replace="common/common :: jscss"/>
    <title>照片类型配置</title>
</head>
<body>

<style>
    .layui-card .layui-form .layui-form-label {
        width: 120px;
    }
    .layui-required:before {
        content: "*\00A0\00A0";
        display: inline-flex;
        color: #ff0000;
    }

</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form method="post" action="" class="layui-form" id="zmn-form" lay-filter="zmn-form">
                <input type="hidden" th:value="${conf.id}" name="id">
                <input type="hidden" name="type" value="1"/>
                <th:block th:if="${conf.id != null}">
                    <label class="layui-form-label">ID：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid">
                            <span id="contentId">[[${conf.id}]]</span>
                        </div>
                    </div>
                </th:block>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">照片类型：</label>
                    <div id="categId" class="layui-input-inline"></div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">排序：</label>
                    <div class="layui-input-inline">
                        <input type="sort" placeholder="排序" id="sort" name="sort" th:value="${conf.sort}"
                               lay-verify="required" class="layui-input"/>
                    </div>
                    <div class="layui-form-mid layui-word-aux">数字越小，越在前面</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">张数：</label>
                    <div class="layui-input-inline">
                        <select name="num" lay-verify="required">
                            <option value="">选择</option>
                            <option value="1" th:selected="${conf.num==1}">1</option>
                            <option value="2" th:selected="${conf.num==2}">2</option>
                            <option value="3" th:selected="${conf.num==3}">3</option>
                            <option value="4" th:selected="${conf.num==4}">4</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">渠道：</label>
                    <div class="layui-input-inline" id="chose-channel-radio" style="width: 280px">
                        <input type="radio"
                               name="channel"
                               class="channel"
                               value="channelIds"
                               checked
                               lay-filter="chose-channel"
                               title="应用渠道">
                        <input type="radio"
                               name="channel"
                               class="channel"
                               lay-filter="chose-channel"
                               value="excludeChannelIds"
                               title="排除渠道"
                               >
                    </div>
                </div>

                <div class="layui-form-item" id="chose-channel-input">
                    <label class="layui-form-label">应用渠道：</label>
                    <div id="channelIds" class="layui-input-inline"></div>
                    <div class="layui-form-mid layui-word-aux">渠道，不选即表示全部渠道应用此配置</div>
                </div>

                <div class="layui-form-item" id="chose-excludeChannelIds-input" style="display: none">
                    <label class="layui-required layui-form-label">排除渠道：</label>
                    <div id="excludeChannelIds" class="layui-input-inline"></div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">应用业务类型：</label>
                    <div id="bizType" class="layui-input-inline"></div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">服务分类：</label>
                    <div  id="servCategIds" class="layui-input-inline"></div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">后台是否审核：</label>
                    <div class="layui-input-inline" style="width: 200px">
                        <input type="radio"
                               name="needReview"
                               class="needReview"
                               value="2"
                               title="是"
                               th:checked="${conf.needReview == 2 || conf.needReview == null}"
                               lay-verify="otherReq">
                        <input type="radio"
                               name="needReview"
                               class="needReview"
                               value="1"
                               title="否"
                               th:checked="${conf.needReview == 1}"
                               lay-verify="otherReq">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">自动审核:</label>
                    <div class="layui-input-inline" style="width: 300px">
                        <input type="radio"
                               name="autoAudit"
                               value="2"
                               th:checked="${conf.autoAudit == 2 || conf.autoAudit == null}"
                               title="是">
                        <input type="radio"
                               name="autoAudit"
                               value="1"
                               th:checked="${conf.autoAudit == 1}"
                               title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">是否必传：</label>
                    <input type="radio"
                           name="mustUpload"
                           class="mustUpload"
                           value="2"
                           title="是"
                           th:checked="${conf.mustUpload == 2 || conf.mustUpload == null }"
                           lay-verify="otherReq">
                    <input type="radio"
                           th:name="mustUpload"
                           class="mustUpload"
                           value="1"
                           title="否"
                           th:checked="${conf.mustUpload == 1}"
                           lay-verify="otherReq">
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">示例照片：</label>
                    <div class="layui-inline">
                        <div class="layui-upload-drag" id="egImgSrc" style="position: relative;">
                            <input type="hidden" class="img-url" id="egSrc" name="egSrc">
                            <i class="layui-icon"></i>
                            <p>点击上传</p>
                            <img src="" id="egImgSrcShow">
                        </div>
                        <div class="layui-inline">
                            <i class="layui-icon layui-icon-search btn-review"></i><br>
                            <i class="layui-icon layui-icon-delete btn-delete"></i>
                        </div>
                        <div class="layui-word-aux">数字越小，越在前面<br> <span style="font-size: 12px;color: rgb(255,0,0)">单张图片大小5M以内，支持jpg、jpeg、png格式图片上传</span>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">说明：</label>
                    <div class="layui-inline">
                        <textarea placeholder="请输入说明内容" maxlength="200" id="description" name="description" th:text="${conf.description}" lay-filter="description"
                                  class="layui-textarea" style="width: 300px;"></textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">详细说明：</label>
                    <div class="layui-inline">
                        <script id="detailDescription" width="900px" name="detailDescription" type="text/plain">
                        </script>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-inline">
                        <button class="layui-btn" lay-submit lay-filter="zmn-form-submit">保存</button>
<!--                        <button class="layui-btn layui-btn-primary">取消</button>-->
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.js"></script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript" th:inline="javascript">
    let toolbars = [
        ['fullscreen', 'source', 'undo', 'redo'],
        ['simpleupload', 'insertimage', 'snapscreen', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc','fontsize']
    ];
    let detailDescriptionUe = UE.getEditor('detailDescription', {
        initialFrameHeight: 200,
        initialFrameWidth: 600,
        maximumWords: 5000,
        autoHeightEnabled: false,
        toolbars: toolbars
    });

    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function (action) {
        // 这里很重要，很重要，很重要，要和配置中的imageActionName值一样
        if (action == 'uploadimage') {
            // 这里调用后端我们写的图片上传接口
            return '/oms/uploaderImage/ueditor';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    }
    //对编辑器的操作最好在编辑器ready之后再做
    detailDescriptionUe.ready(function () {
        // 向富文本框回显后台返回的内容
        detailDescriptionUe.execCommand('insertHtml', [[${conf.detailDescription}]]);
    });
</script>

<script th:inline="javascript">
    let dataVo = [[${conf}]];

    layui.config({
        base: "/static/js/module/",
        version: 20221013001,
    }).extend({
        oms_conf_attachment_orderPicture_detail: "conf/attachment/orderPicture/zmn.oms.conf.orderPicture.detail"
    }).use(['oms_conf_attachment_orderPicture_detail']);
</script>

</body>
</html>